package com.ysh.smartplatform.mapper;

import com.ysh.smartplatform.pojo.SysUserInfo;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * 袁胜虎 on 2022/9/5 11:31
 */
public interface UserMapper {

    @Insert("INSERT INTO sys_user_info (username,password,pwd_salt,`name`,phone,email,sex,create_by,remark) VALUES (#{username},#{password},#{pwdSalt},#{name},#{phone},#{email},#{sex},#{createBy},#{remark})")
    void addUser(SysUserInfo sysUserInfo);

    List<SysUserInfo> findByUserNameOrPhoneOrEmail(@Param("userName") String userName, @Param("phone") String phone, @Param("email") String email);

    SysUserInfo findUserByName(String userName);

    void updateLoginDataByUserId(@Param("uId") Long uId,@Param("ip") String ip);

    @Delete("delete from sys_user_info where u_id = #{uId}")
    void deleteById(String id);
}
